# -*- coding:utf-8 -*-

import os
from selenium import webdriver
from AutoTestBDC.extScript.Excel import RdExcel
from AutoTestBDC.WorkFlow.CS import CS
from AutoTestBDC.WorkFlow.GT import GT
from AutoTestBDC.WorkFlow.ZS import ZS
from AutoTestBDC.WorkFlow.RWJG import RWJG


class WorkFlow:
    def __init__(self,driver, caseno, qlrtype):
        re = RdExcel(filepath="inputdata\\不动产流程定义.xlsx")
        self.listwf = re.getWorkFlowByExcel(type="流程定义")
        self.driver = driver
        self.caseno = caseno
        self.qlrtype = qlrtype

        self.test_workflow()

        # self.driver = webdriver.Firefox()
        # iedriver = os.getcwd() + "\\IEDriverServer.exe"
        # os.environ["webdriver.ie.driver"] = iedriver
        # self.driver = webdriver.Ie(executable_path=iedriver)
        # self.driver.maximize_window()
        # self.driver.implicitly_wait(10)
        # self.base_url = "http://192.168.200.248:8080"
        # self.verificationErrors = []
        # self.accept_next_alert = True
        # self.driver.get(self.base_url + "/RealestateTrade")

    def test_workflow(self):
        for wf in self.listwf:
            if wf[1] == "柜台":
                GT(self.driver, wf[2], wf[3], wf[4], self.caseno, self.qlrtype)

            if wf[1] == "初审":
                CS(self.driver, wf[2], wf[3], wf[4], self.caseno, self.qlrtype)

            if wf[1] == "终审":
                ZS(self.driver, wf[2], wf[3], wf[4], self.caseno, self.qlrtype)

            if wf[1] == "入围机构":
                RWJG(self.driver, wf[2], wf[3], wf[4], self.caseno, self.qlrtype)


if __name__ == '__main__':
    wf = WorkFlow("20160709000012", "自然人")
    wf.test_workflow()
